:root {
  --primary-color: #4a6fa5;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --info-color: #17a2b8;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-bg: #f8f9fa;
  --dark-bg: #2c3e50;
  --card-bg: #ffffff;
  --border-color: #dee2e6;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #1a2a6c, #2c3e50);
  min-height: 100vh;
  padding: 15px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  min-width: 320px;
  height: 95vh;
  min-height: 600px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, var(--primary-color), #2e4e7e);
  color: white;
  padding: 15px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  font-size: 2rem;
  background: white;
  color: var(--primary-color);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.app-title {
  margin: 0;
  font-weight: 600;
}

.app-subtitle {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-connected {
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
}

.status-disconnected {
  background-color: var(--danger-color);
}

.status-connecting {
  background-color: var(--warning-color);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 300px;
  background: var(--light-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin: 15px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  background: var(--light-bg);
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  flex: 1;
  padding: 15px;
  overflow: auto;
}

.panel-footer {
  padding: 10px 15px;
  border-top: 1px solid var(--border-color);
  background: var(--light-bg);
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f9f9f9;
}

.chat-input {
  display: flex;
  padding: 15px;
  border-top: 1px solid var(--border-color);
  background: white;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  margin-bottom: 12px;
  position: relative;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.me {
  background: linear-gradient(135deg, #d1e7dd, #b8e0d2);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message-bubble.other {
  background: linear-gradient(135deg, #e2e3e5, #d1d5db);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  color: var(--secondary-color);
  text-align: right;
  margin-top: 5px;
}

.system-message {
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.85rem;
  margin: 10px 0;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.log-panel {
  height: 200px;
  overflow-y: auto;
  background: #2c3e50;
  color: #ecf0f1;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: 8px;
}

.log-entry {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.4;
}

.log-timestamp {
  color: #95a5a6;
  margin-right: 8px;
}

.log-info {
  color: #3498db;
}

.log-success {
  color: #2ecc71;
}

.log-warning {
  color: #f39c12;
}

.log-error {
  color: #e74c3c;
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-weight: bold;
}

.user-name {
  flex: 1;
}

.user-status {
  font-size: 0.8rem;
  color: var(--secondary-color);
}

.btn-action {
  background: linear-gradient(135deg, var(--primary-color), #3a5f8d);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
  transform: translateY(0);
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.input-field {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

.message-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

.encryption-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(40, 167, 69, 0.15);
  color: var(--success-color);
  border-radius: 20px;
  font-size: 0.8rem;
  margin-top: 5px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: var(--light-bg);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.chat-disabled .message-input,
.chat-disabled .btn-send {
  opacity: 0.5;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--secondary-color);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.3;
}

@media (max-width: 768px) {
  .app-body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: 40%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .app-container {
    height: 100vh;
    border-radius: 0;
  }
}